import grails.test.*

class ProjectTests extends GrailsUnitTestCase {
    protected void setUp() {
      super.setUp()
    }

    protected void tearDown() {
      super.tearDown()
    }

    void testcalcStatus() {
        Type typ = new Type(type: "lab")
        Container con = new Container(name: "ida")
        Area are = new Area(areaId: "1", name: "Område1", container: con, type: typ)
        Project pro = new Project(activityId: "1", name: "Testproj", description: "Detta är ett testproject", area: are, mode: "1", startDate: new Date('12/24/2009'), endDate: new Date('12/28/2010'))

        Project pro2 = new Project(activityId: "2", name: "Testproj2", description: "Detta är ett testproject", area: are, mode: "1", startDate: new Date('08/08/2009'), endDate: new Date('09/10/2009'))

        Project pro3 = new Project(activityId: "3", name: "Testproj3", description: "Detta är ett testproject", area: are, mode: "1", startDate: new Date('08/08/2009'), endDate: new Date('12/24/2009'))

        assertEquals pro.calcStatus(), "Planned"
        assertEquals pro2.calcStatus(), "Done"
        assertEquals pro3.calcStatus(), "Progressing"
     }

    void testToString(){
        Type typ = new Type(type: "lab")
        Container con = new Container(name: "ida")
        Area are = new Area(areaId: "1", name: "Område1", container: con, type: typ)
        Project pro = new Project(activityId: "1", name: "Testproj", description: "Detta är ett testproject", area: are, mode: "1", startDate: new Date(2010,01,22), endDate: new Date(2010,10,24))

        assertEquals pro.toString(), "MODE: 49 (1), Testproj"

    }

    void testcalcIncomingBalance(){
        
    }

    void testcalcCurrentBalance(){

    }

    void testcalcTotalIncome(){

    }

    void testcalcTotalCost(){

    }

 }


